package cn.hesion.leetcode;
/**
 * ClassName: TreeMaxDepth <br/>
 * Description: <br/>
 * date: 2022/5/19 6:37<br/>
 *
 * @author Hesion<br />
 * @version
 * @since JDK 1.8
 */


/**
 * @author: hesion
 * @create: 2022-05-19 06:37
 **/
public class TreeMaxDepth {

    public int maxDepth(TreeNode root) {
        if (root == null) {
            return 0;
        }
        return Math.max(maxDepth(root.left), maxDepth(root.left)) + 1;
    }
}

class TreeNode {
    int val;
    TreeNode left;
    TreeNode right;

    TreeNode() {
    }

    TreeNode(int val) {
        this.val = val;
    }

    TreeNode(int val, TreeNode left, TreeNode right) {
        this.val = val;
        this.left = left;
        this.right = right;
    }
}